/**
 * Copyright(c) kyle.
 */
package org.example.netty.http;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * 服务器初始化处理器
 *
 * @author kyle
 * @version 1.00.00
 * @since [2020-07-05 10:22]
 * @updateUser [Kyle]
 * @updateRemark [说明本次修改内容]
 * @date [2020-07-05 10:22]
 */
public class TestServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(final SocketChannel ch) throws Exception {
        //向管道加入处理器
        //得到管道
        ChannelPipeline lvChannelPipeline = ch.pipeline();
        //加入一个netty提供的hettpServerCodec
        lvChannelPipeline.addLast("MyHttpServerCodec",new HttpServerCodec());
    }
}
